package homework;


import java.util.*;

public class Cvte {
    public static void main1(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine().toLowerCase(Locale.ROOT);

        StringBuilder stringBuilder = new StringBuilder(str);
        for(int i=0;i<str.length();i++){
            char k = (char) (scanner.nextInt()-'0');
            for(int j = 0 ;j<= i ;j++){
                char a = (char) ((char) (str.charAt(j) + (char) k)>'z'?(str.charAt(j) + (char) k):(str.charAt(j) + (char) k)-'a');
                stringBuilder.replace(j,j,a+"");
            }
        }
        System.out.println(stringBuilder);
    }
    public int longestConsecutive(int[] nums) {
        HashSet<Integer> hashSet = new HashSet<>();
        for (int i = 0; i < nums.length; i++) {
            hashSet.add(nums[i]);
        }
        int sum = 0;
        for (Integer integer :hashSet) {
            if (!hashSet.contains(integer-1)) {
                int k = integer + 1;
                int count = 1;
                while (hashSet.contains(k)){
                    count++;
                    k++;
                }
                sum = Math.max(sum,count);
            }
        }
        return sum;
    }
    //打家劫舍
    public static int rob(int[] nums) {
        if(nums.length == 0){
            return -1;
        }
        if(nums.length == 1){
            return nums[0];
        }
        if(nums.length == 2){
            return Math.max(nums[0],nums[1]);
        }
        int[] arr= new int[nums.length];
        arr[0] = nums[0];
        arr[1] = Math.max(nums[0],nums[1]);

        for (int i = 2; i < arr.length; i++) {
            arr[i] = Math.max(arr[i-1],arr[i-2]+ nums[i]);
        }
        return arr[nums.length -1];

    }

    public static void main(String[] args) {
        rob(new int[]{1,2,3,1});
    }
}
